<?php
$showStats = true;
include_once ("includes/header.php");

uasort($teams->teams, "leagueSort");
$teamSpps = array ();
foreach ($teams->teams as $team) {
    array_push($teamSpps, new TeamSPPs($team));
}

$sort = getParam("sort");
switch ($sort) {
    case 1 :
        uasort($teamSpps, "sortTeamSPPsCompletions");
        break;
    case 2 :
        uasort($teamSpps, "sortTeamSPPsTouchdowns");
        break;
    case 3 :
        uasort($teamSpps, "sortTeamSPPsInterceptions");
        break;
    case 4 :
        uasort($teamSpps, "sortTeamSPPsCasualties");
        break;
    case 5 :
        uasort($teamSpps, "sortTeamSPPsMVPS");
        break;
    case 6 :
        uasort($teamSpps, "sortTeamSPPsTotal");
        break;
    case 7 :
        uasort($teamSpps, "sortTeamSPPsTotalGame");
        break;
    case 8 :
        uasort($teamSpps, "sortTeamSPPsTotalPlayer");
        break;
    case 9 :
        uasort($teamSpps, "sortTeamSPPsTotalPlayerGame");
        break;
    case 10 :
        uasort($teamSpps, "sortTeamSPPsExps");
        break;
}

echo<<< EOQ
            <caption><h1>Team Star Player Points</h1></caption>
            <tr align="center">
              <th>Team</th>
              <th>Race</th>
              <th><a href="?sort=1">Cp</a></th>
              <th><a href="?sort=2">Td</a></th>
              <th><a href="?sort=3">In</a></th>
              <th><a href="?sort=4">Cs</a></th>
              <th><a href="?sort=5">MVPs</a></th>
              <th><a href="?sort=10">Exps</a></th>
              <th><a href="?sort=6">Total</a></th>
              <th><a href="?sort=7">Game</a></th>
              <th><a href="?sort=8">Player</a></th>
              <th><a href="?sort=9">Player Game</a></th>
            </tr>

EOQ;

$i = 1;
foreach ($teamSpps as $spps) {
    $spps->echoRow($i++);
}

echo<<< EOQ
            <tr>
              <td colspan="11" align="left"><br />This table shows the break down of star player points the team currently has.
              </td>
            </tr>
            <tr>
              <td colspan="11" align="left"><br />Comments on Team SPPs<br />
                <ul>
                  <li><b>Cp :-</b> Average Completions per game</li>
                  <li><b>Td :-</b> Average Touchdowns per game</li>
                  <li><b>In :-</b> Average Interceptions per game</li>
                  <li><b>Cs :-</b> Average Casualties per game</li>
                  <li><b>MVPs :-</b> Average MVPs per game</li>
                  <li><b>Exps :-</b> Average Exps per game</li>
                  <li><b>Total :-</b> Total SPPs</li>
                  <li><b>Game :-</b> Average SPPs per game</li>
                  <li><b>Player :-</b> Average SPPs per player</li>
                  <li><b>Player Game :-</b> Average SPPs per player per game</li>
                </ul>
              </td>
            </tr>

EOQ;

include ("includes/footer.php");
?>
